const { Router } = require('express');

const { apiKeyMiddleware } = require('../middleware/apiKey');
const { createDocsRouter } = require('./docs.routes');
const { createHealthRouter } = require('./health.routes');
const { createIconsRouter } = require('./icons.routes');
const { createAiRouter } = require('./ai.routes');

const healthRouter = createHealthRouter();

const apiRouter = Router();
apiRouter.use(apiKeyMiddleware());
apiRouter.use('/docs', createDocsRouter());
apiRouter.use('/icons', createIconsRouter());
apiRouter.use('/ai', createAiRouter());

apiRouter.get('/version', (req, res) => {
  res.json({
    service: 'superdb',
    version: '0.1.0'
  });
});

module.exports = {
  apiRouter,
  healthRouter
};
